import request from '@/utils/request'
const serverName = process.env.VUE_APP_API_BASIC_AUTHORITY_WEB_SERVICE_URL
const userApi = {
  UserInfo: serverName + '/v1/user/getDetail',
  GetToken: serverName + '/v2/oauth/getToken',
  getTokenByZyToken: serverName + '/common/getTokenByZyToken',
  Logout: serverName + '/v2/oauth/logout',
  RefreshToken: serverName + '/v2/oauth/refreshToken',
  getIdentities: serverName + '/v1/user/getIdentities'
}

export function getInfo () {
  return request({
    url: userApi.UserInfo,
    method: 'get'
  })
}
export function getToken (params) {
  return request({
    url: userApi.GetToken,
    method: 'get',
    params
  })
}
export function getTokenByZyToken (params) {
  return request({
    url: userApi.getTokenByZyToken,
    method: 'get',
    params
  })
}
export function logout (params) {
  return request({
    url: userApi.Logout,
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    params
  })
}
export function refreshToken (params) {
  return request({
    url: userApi.RefreshToken,
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    params
  })
}

export function getIdentities (params) {
  return request({
    url: userApi.getIdentities,
    method: 'get',
    params
  })
}
